package com.czl.elm.controller;


import com.czl.elm.domain.Order;
import com.czl.elm.service.IOrderService;
import com.czl.elm.util.ActionResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zuoleiChen
 * @since 2021-06-18
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private IOrderService orderService;

    @ApiOperation("生成订单")
    @PostMapping("/createOrder")
    public ActionResult createOrder(@RequestBody Map<String,Object> msg){

        return orderService.createOrder(msg);
    }

    @ApiOperation("查询订单")
    @GetMapping("/getOrder")
    public ActionResult getOrder(String orderId){
        return orderService.getOrder(orderId);
    }

    @ApiOperation("查询用户订单的list")
    @GetMapping("/getOrderList")
    public ActionResult getOrderList(Integer currentPage,  Integer size){
        return orderService.getOrderList(currentPage,size);
    }

    @ApiOperation("查询订单的商家信息和购物车信息")
    @GetMapping("/getOrderBase")
    public ActionResult getOrderBase(String orderId){
        return orderService.getOrderBase(orderId);
    }
}
